package com.example.runningman.view;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.ScrollView;
import android.widget.TextView;

import com.example.runningman.R;
import com.qmuiteam.qmui.util.QMUIDisplayHelper;
import com.qmuiteam.qmui.util.QMUIResHelper;
import com.qmuiteam.qmui.util.QMUIViewHelper;
import com.qmuiteam.qmui.widget.dialog.QMUIDialog;

import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat;

import static com.baidu.mapapi.BMapManager.getContext;

public class QMAutoTestDialogBuilder extends QMUIDialog.AutoResizeDialogBuilder {
    private Context mContext;
    private EditText mEditText;

    public QMAutoTestDialogBuilder(Context context) {
        super(context);
        mContext = context;
    }

    @Override
    public View onBuildContent(@NonNull QMUIDialog dialog, @NonNull Context context) {
        LinearLayout layout = new LinearLayout(mContext);
        layout.setOrientation(LinearLayout.VERTICAL);
        layout.setLayoutParams(new ScrollView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
        int padding = QMUIDisplayHelper.dp2px(mContext, 20);
        layout.setPadding(padding, padding, padding, padding);
        mEditText = new EditText(mContext);
        QMUIViewHelper.setBackgroundKeepingPadding(mEditText, QMUIResHelper.getAttrDrawable(mContext, R.drawable.button_selector));
        mEditText.setHint("输入框");
        LinearLayout.LayoutParams editTextLP = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, QMUIDisplayHelper.dpToPx(50));
        editTextLP.bottomMargin = QMUIDisplayHelper.dp2px(getContext(), 15);
        mEditText.setLayoutParams(editTextLP);
        layout.addView(mEditText);
        return layout;
    }

    public EditText getEditText() {
        return mEditText;
    }


}
